﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using GamePlusClassLibrary;


namespace GamePlus.UserControls
{
    public partial class mod_gamesnow : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
                this.Inicializar();
        }

        private void Inicializar()
        {
            loadContent();
        }

        private void loadContent()
        {
            //string sContent = "<ul class=\"glistside\">";

            //List<rating_most_played> ls = ratings.getGamesHour();

            //ls.ForEach(delegate(rating_most_played obj)
            //{
            //    sContent += "<li><a href=\"/game/"+ obj.game_id.ToString() +"\" class=\"bdc5\">";
            //    sContent += "<img class=\"img bdc2\" src=\""+ getImgUrl(obj.game_id) +"\" alt=\"\">";
            //    sContent += "<span class=\"gname link1\">" + obj.game_name + "</span>";
            //    sContent += "<span class=\"smalltext\">Jogado: "+ obj.plays_count.ToString() +" vezes<br />High Score: "+ obj.score.ToString() +"</span></a></li>";
            //});

            //sContent += "</ul>";
            /////images/games/000/000/618/logo_thumb.png?1285855813
            /////http://www.otzee.com.br/images/games/000/000/618/logo_thumb.jpg
            //divJogosHora.InnerHtml = string.Empty;
            //divJogosHora.InnerHtml = sContent;
        }

        private string getImgUrl(int id)
        {
            string sZero = string.Empty;
            int cont = 3 - id.ToString().Length;
            for (int i = 0; i < cont; i++)
                sZero += "0";

            return "http://www.otzee.com.br/images/games/000/000/" + sZero + id.ToString() + "/logo_thumb.jpg";
        }
    }
}